import { IObject } from "@/composables/Animation";
import Two from "two.js";
import { Rectangle } from "two.js/src/shapes/rectangle";

export class Rect implements IObject {
  private rectangle: Rectangle | undefined;
  private two: Two | undefined;

  init(two: Two): void {
    this.two = two;

    const radius = 50;
    const x = 0;
    const y = 0;
    const width = 100;
    const height = 100;
    this.rectangle = two.makeRectangle(x, y, width, height);
    this.rectangle.fill = "rgb(0, 200, 255)";
    this.rectangle.opacity = 0.75;
    this.rectangle.noStroke();
  }

  Next(frame: number): void {
    const rect = <Rectangle>this.rectangle;
    rect.translation.x += 1;
    rect.translation.y += 1;
  }
}
